
public class complex {
	private double real, imaginary;
	
	
	public complex(double real, double imaginary){
		this.real = real;
		this.imaginary = imaginary;
	}
	
	public double real(){
		return this.real;
	}
	
	public double imaginary(){
		return this.imaginary;
	}
	
	public double norm(){
		return Math.sqrt(Math.pow(real, 2)+Math.pow(imaginary, 2));
	}
	
	public void addComplex(double real, double imaginary){
		this.real = this.real+real;
		this.imaginary = this.imaginary+imaginary;
	}
	
	public void addComplex(complex number){
		this.addComplex(number.real(), number.imaginary());
	}
	
	public static complex mulComplex(complex num1, complex num2){
		return new complex(
				num1.real()*num2.real() - num1.imaginary()*num2.imaginary(),
				num1.imaginary()*num2.real() + num1.real()*num2.imaginary()
				); 
	}
	
	public static complex divComplex(complex num1, double denum){
		return new complex(num1.real()/denum, num1.imaginary()/denum); 
	}

	public complex getConjugate() {
		return new complex(this.real, -1*this.imaginary);
	}
	public void print(){
		System.out.println(real+" i"+imaginary);
	}
}
